<?php
namespace Admin\Model;
use Think\Model;

class WaterMarkModel extends AbstractModel {

    public $_validate = array(
        array('Name','require','水印名称',Model::MUST_VALIDATE),
        array('ImgUrl','require','上传水印图片',Model::MUST_VALIDATE),
    );
    //获取合同列表
    public function MyshowList(){
        $where = " 1 ";
        $keyword = I('keyword');
        if(!empty($keyword)){
            $where .= " AND Name like '%$keyword%' ";
        }
        $return = array();
        $sql = " SELECT COUNT(*) count FROM watermark WHERE $where ";
        $count = $this->query($sql);
        $count = $count[0]['count'];
        $page = $this->Mypage($count, 8);
        $sql = "SELECT ID,`Name`,ImgUrl,AddTime FROM watermark WHERE $where ORDER BY ID DESC LIMIT  $page->firstRow , $page->listRows";
        $res = $this->query($sql);
        $return['list'] = $res;
       // var_dump($res); exit();
        $return['page'] = $page->show('Admin');
        return $return;
    }

    

   

}